//Fri Jul 29 21:37:31 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class WorldPeace {
public:
	long long numGroups(int, vector <int>);
};

long long WorldPeace::numGroups(int k, vector <int> c) {
	long long hi = 10000000000000000LL;
	long long lo = 0LL;
	while(hi > lo){
		long long mid = (hi + lo + 1) / 2;
		long long sum = 0LL;
		for(int i=0; i<c.size(); i++){
			sum += c[i]<mid ? c[i]:mid;
		}
		if(sum < mid * k) hi = mid-1;
		else lo = mid;
	}
	return hi;
}


//Powered by [KawigiEdit] 2.0!
